package cn.liuweiwei.util;

import java.util.Random;

public class RandomCharsUtils {

	private static char[] chars = null;
	private static Random random = new Random();

	private RandomCharsUtils() {
	}

	static {
		initChars();
	}

	private static void initChars() {
		chars = "abcdefghijklmnopqrstuvwxyz0123456789".toCharArray();
	}

	public static String RandomChars(int number) {
		String result = "";
		for (int i = 0; i < number; i++) {
			result += chars[RandomIndex()];
		}
		return result;
	}

	private static int RandomIndex() {
		return random.nextInt(chars.length);
	}

}
